<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="../iconfont/iconfont.css" />
    <link rel="stylesheet" href="../css/bot.css" />
    <link rel="stylesheet" href="../css/login.css" />
    <script src="../node_modules/axios/dist/axios.js"></script>
  </head>
  <body>
    <div id="app">
      <!-- 标题 -->
      <div class="title">
        <span class="iconfont icon-fanhuijiantou"></span>
        <h3>会员登录</h3>
      </div>
      <!-- 手机号 -->
      <div class="main">
        <h2>手机号登录</h2>
        <p>未注册的手机号登录将自动注册</p>
        <!-- 输入手机号 -->
        <div class="top">
          <input type="text" placeholder="请输入手机号" v-model="number" />
        </div>
        <!-- 图形验证码 -->
        <div class="bot">
          <input type="text" placeholder="请输入图形验证码" v-model="add" />
          <img :src="msg" alt="" @click="this.loginList" />
        </div>
        <!-- 短信验证码 -->
        <div class="botton">
          <input type="text" placeholder="请输入验证码" id="" v-model="dx" />
          <span @click="dj">获取验证码</span>
        </div>
      </div>
      <footer>
        <span @click="loadd">登录</span>
      </footer>
    </div>
    <script src="../vue.js"></script>
    <script>
      const app = new Vue({
        el: '#app',
        data: {
          msg: '',
          add: '',
          number: '',
          dx: ''
        },
        created() {
          this.loginList()
        },
        methods: {
          async loginList() {
            const res = await axios.get(
              'http://cba.itlike.com/public/index.php?s=/api/captcha/image'
            )
            console.log(res.data)
            this.msg = res.data.data.base64
            this.key = res.data.data.key
          },
          async dj() {
            console.log(123)
            const res = await axios.post(
              'http://cba.itlike.com/public/index.php?s=/api/captcha/sendSmsCaptcha',
              {
                form: {
                  captchaCode: this.add,
                  captchaKey: this.key,
                  mobile: this.number
                }
              }
            )
            console.log(res)
          },
          async loadd() {
            const res = await axios.post(
              'http://cba.itlike.com/public/index.php?s=/api/passport/login',
              {
                form: {
                  isParty: false,
                  mobile: this.number,
                  partyData: {},
                  smsCode: this.dx
                }
              },
             { headers:{platform: 'H5'}}
            )
            console.log(123)
            console.log(res)
          }
        }
      })
    </script>
    <!-- <script src="../js/login.js"></script> -->
  </body>
</html>
